﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace UltralightMarkup.Controllers
{
    public class SubmitController : Controller
    {
      //
      // POST: /Submit/
			[ValidateInput(enableValidation:false)]
      public ActionResult Index(FormCollection collection)
      {
				if (collection.Count > 0)
				{
					// The unformatted text is safe to store only after you call HtmlEncode like this.
					ViewData["Unformatted"] = System.Web.HttpUtility.HtmlEncode(collection[0]);

					var Transformer = new UltralightTransformer.Transform();
					// This is also safe.  Anything that comes from MakeHTML will be safe.
					ViewData["Formatted"] = Transformer.MakeHTML(collection[0]);
				}

        return View();
      }

    }
}
